This invention relates to a method and apparatus for fast computation of associative operations over fixed size regions of a digital image. More particularly, this invention relates to the application of associative operations—such as MINIMUM, MAXIMUM, AND and OR—to fixed size regions of a digital image such as hexagonal, octagonal and rectangular regions. This is accomplished by tiling the image and calculating two-dimensional running calculations of the operator for each possible corner overlap configuration of a window that is run over the tiles of the image and thus used to analyze the image. Combining the appropriate running calculations for a particular window position yields the final result for that position
While the invention is particularly directed to the art of digital imaging, and will be thus described with specific reference thereto, it will be appreciated that the invention may have usefulness in other fields and applications. For example, the principles of the invention may be implemented in any field where the determination of associative properties across an array of values is useful.
By way of background, a commonly assigned, co-pending patent application, which issued as U.S. Pat. No. 6,714,694 B1 to Marshall entitled “A Method for Sliding Window Image Processing of Associative Operators”—which is incorporated herein by this reference—describes a method for fast computation of associative operators for a fixed size window in one dimension. As disclosed therein, by repeating the process, it may be extended to application to a rectangular window in two dimensions. However, the rectangular shape is usually not ideal for image processing operations. Regions that more closely resemble circles yield better results.
More particularly, the '726 application first considers the problem of applying an operation to a moving segment along a scan line in one dimension and then discloses that the process may be applied to two dimensions. In this regard, the '726 application considers, for a sliding window of size n, the data is first divided into (n+1)−element blocks. Then, for each element in the block starting from the left end of the block the operation is successively applied to the previous result and the next element of the block. Similarly, from the right end of the block the operation is successively applied to the previous result and the next element of the block. At this point, it should be understood that one does not need to calculate the operation across the entire block as this would be across n+1 elements and the sliding window contains only n elements. The next step of the method involves the step of for each position of the sliding window determining which block or blocks lie under the sliding window and, if this is a single block, retrieving the value calculated for the elements of the sliding window, or if there are two blocks, combining the previously calculated values in each block corresponding to the part of the sliding window contained in the block. It takes n−1 operations to calculate the left-end results in each block, n−1 operations to calculate the right-end results in each block, and n−1 operations to calculate the n−1 possible overlap positions thereby generating a total of 3*n−3 operations to calculate n+1 windowed results Note that two of the sliding window positions do not overlap two blocks and no further calculation is necessary in these cases. This averages to less than 3 operations per calculated value.
For example, to calculate a MIN function in a sliding window of length n, an appropriate block size is n+1 because a window of size n always contains an edge of every block it intersects. Then, in each block, calculate and remember successive cumulative minimums from the left edge and then from the right edge Now, for any position of the sliding window, the minimum in the sliding window can be calculated with at most one more MIN operation. If the sliding window is completely contained in a single block then either the left edge of the sliding window coincides with the left edge of the containing block or the right edge of the sliding window coincides with the right edge of the containing block and the minimum has already been calculated. If the sliding window overlaps two blocks then the minimum in the sliding window can be calculated by taking the minimum of the part of the left block overlapped by the sliding window and the part of the right block overlapped by the sliding window and both of these values have been previously calculated. The total number of operations for this example is (n−1 operations per block for calculations from the left end of the block)+(n−1 operations per block for calculations from the right end of the block)+(n−1 operations to combine results for cases where the sliding window straddles two blocks)+(0 operations in the two cases when the sliding window is contained within a single block)=3n−3 operations to handle n+1 positions of the sliding window or (3n−3)M/(n+1) or about 3M, where M is the scan length, as compared to (n−1)M using prior art, where n is the length of the sliding window
As an example, consider the data identified by ABCDEFGHIJK with a sliding window length of 4. If we block by 4+1=5 with a sliding window length of 4 then the calculation proceeds as follows:
ABCDE|FGHIJ|KLMNO|. . . (blocking of the data by 5)AB = op(A,B)operating from left end of block 1ABC = op(AB,C)ABCD = op(ABC,D)DE = op(D,E)operating from the right end of block 1CDE = op(C,DE)BCDE = op(B,CDE)FG = op(F,G)operating from the left end of block 2FGH = op(FG,H)FGHI = op(FGH,I)IJ = op(I,J)operating from the right end of block 2HIJ + op(H,IJ)GHIJ = op(G,HIJ)KL = op(K,L)operating from the left end of block 3KLM = op(KL,M)KLMN = op(KLM,N)etc. and now calculate the sliding window values as    ABCD—already calculated above    BCDE—already calculated above    op(CDE,F)    op(DE,FG)    op(E,FGH)    FGHI—already calculated above    GHIJ—already calculated above    op(HIJ,K)    op(IJ,KL)    op(J,KLM)    KLMN—already calculated    LMNO—already calculatedetc.
Two-dimensional rectangular windows can be calculated by first using the method along rows and storing these results in a two-dimensional array then taking these results and applying the method to columns of this array.
Thus, the approach disclosed in the '726 application for conducting the above described operation for a two-dimensional rectangular box is to calculate the one-dimensional operation for each row of the window and then use the same approach for the columns of row results. However, an alternative method for generalizing such a process to two dimensions is desired. It is also desirable to be able to adapt such an alternative process to be applicable to octagonal and hexagonal window shapes, which are more conducive to image analysis
The present invention contemplates a new and improved method and apparatus for fast computation of associative operations over fixed size regions that resolves the above-referenced difficulties and others.